/**
 * Created by json on 2016/12/30.
 */
dwc.DLRoomManagerDialog=dwc.CommonAlertView.extend({
    ctor: function (target) {
        this._super();
        this.target = target;
        this.initUI();
    },
    initUI: function () {
        var that = this;
        var mainNode = this.mainNode = ccs.load(dwc.g_arrGCRes.dt_dlRoomManager_json).node;
        this.addChild(mainNode);
        this.noMsgLabel=$.getNodeByName(mainNode,"ID_LABLE_NOMSG");

        var closeBtn=$.getNodeByName(mainNode,"ID_BUTTON_CLOSE");
        closeBtn.addClickEventListener(function () {
            that.Close();
        });

        var cjfjBtn=$.getNodeByName(mainNode,"ID_BUTTON_CJFJ");
        cjfjBtn.addClickEventListener(function () {
            that.OnCreateRoom();
        });
        var zhanjiBtn=$.getNodeByName(mainNode,"ID_BUTTON_ZHANJI");
        zhanjiBtn.addClickEventListener(function () {
            that.OnZhanJiBtn();
        });


        dwc.DT_Data_Login.SendFangGuanRoomList(this.OnCallBackMsg.bind(this));
    },
    OnCallBackMsg: function (_msg) {



        this.roomList = [];
        for(var i=0;i<_msg.rooms.length;i++)
        {
            if(_msg.rooms[i])
            {
                this.roomList[i] =_msg.rooms[i];
            }else{
                break;
            }
        }
        this.initTable(this.mainNode);
        cc.log("");
    },
    OnCreateRoom: function () {
        var dlg=new dwc.DLCreateRoomDialog(this);
        this.addChild(dlg);
        dlg.Show();

        //dwc.DT_Data_Login.SendCreateRoom("NIUNIU","8JU","1");
    },
    OnZhanJiBtn: function () {
        var dlg=new dwc.DLZhanJiDialog(this);
        this.addChild(dlg);
        dlg.Show();

        //dwc.DT_Data_Login.SendCreateRoom("NIUNIU","8JU","1");
    },
    initTable: function (mainNode)
    {
        if(this.roomList &&this.roomList.length > 0)
        {
            this.noMsgLabel.setVisible(false);
        }
        this.tableBack=$.getNodeByName(mainNode,"ID_LAYOUT_TABLEBACK");

        if(!this.tableView)
        {
            this.tableView=new cc.TableView(this,cc.size(1280,620));
            this.tableView.setDirection(cc.SCROLLVIEW_DIRECTION_VERTICAL);
            this.tableView.setDelegate(this);
            this.tableView.setVerticalFillOrder(cc.TABLEVIEW_FILL_TOPDOWN);
            this.tableBack.addChild(this.tableView);


        }
        this.tableView.reloadData();
        var pt = this.tableView.minContainerOffset();
        this.tableView.setContentOffset(pt);
    },
    tableCellTouched:function (table, cell) {

        /*
         cc.log("cell touched at index: " + cell.getIdx());
         var index=cell.getIdx()+1;

         var detail=new dwc.DT_ZhanJiDetail();
         this.addChild(detail);
         detail.Show();
         */
    },
    tableCellSizeForIndex:function(table, idx){
        return cc.size(1280,160);
    },
    tableCellAtIndex:function (table, idx) {
        var cell=table.dequeueCell();
        if (!cell){
            cell=new dwc.DLRoomInfoCell(idx,this.roomList);
        }else {
            cell.refresh(idx,this.roomList);
        }
        return cell;
    },
    numberOfCellsInTableView:function (table) {

        return this.roomList.length;
    },
});
//战绩cell
dwc.DLRoomInfoCell=cc.TableViewCell.extend({
    number:null,
    background:null,
    mRoomID : 0,
    ctor:function(idx,data){
        this._super();
        this.width=1280;
        this.height=160;
        var mainNode = ccs.load(dwc.g_arrGCRes.dt_dlRoomMainCell_json).node;
        this.addChild(mainNode);

        var that = this;
        var shareBtn = $.getNodeByName(mainNode,"ID_BUTTON_SHARE");
        shareBtn.addClickEventListener(function ()
        {
            this.OnShare();

        }.bind(this));

        var dissmissBtn = $.getNodeByName(mainNode,"ID_BUTTON_DISMISS");
        dissmissBtn.addClickEventListener(function ()
        {
            //查看
            dwc.DT_Data_Login.SendDismissRoom(that.mRoomID);
        }.bind(this));

        this.roomIDLabel=$.getNodeByName(mainNode,"ID_LABEL_ROOMID");
        this.roomInfoLabel=$.getNodeByName(mainNode,"ID_LABEL_ROOMINFO");
        this.userInfoList=[];
        for(var i=0;i<5;i++){
            var userInfo={};
            userInfo.name=$.getNodeByName(mainNode,"ID_LABEL_NAME"+i);
            userInfo.userId=$.getNodeByName(mainNode,"ID_LABEL_USERID"+i);
            this.userInfoList[i]=userInfo;
        }
        this.idx = idx;
        this.data = data;
        this.refresh(idx,data);

    },
    refresh:function(idx,data) {
        var vecArg = data[idx].split("|");

        try
        {
            this.mRoomID = parseInt(vecArg[5]);
        }catch (e)
        {
            this.mRoomID = 0;
        }

        this.roomIDLabel.setString("房间ID:"+vecArg[5]);
        this.roomInfoLabel.setString(vecArg[7]);

        for(var i=0;i<5;i++){
            if(parseInt(vecArg[i].split("#")[0]))
            {
                var userInfo=this.userInfoList[i];
                userInfo.name.setString(vecArg[i].split("#")[1]);
                userInfo.userId.setString(vecArg[i].split("#")[0]);
            }else {
                var userInfo=this.userInfoList[i];
                userInfo.name.setString("");
                userInfo.userId.setString("");
            }

        }
    },
    OnShare : function(){
        //test
        var vecArg = this.data[this.idx].split("|");
        this.m_nRound =0;

        //test  end

        var obj = {};
        var bundle = $.getBundleID();

        try
        {

            if (cc.sys.os == cc.sys.OS_ANDROID) {

                var iconUrl="http://img.cjpoker.com/csnn.png";
                //var appUrl="http://a.app.qq.com/o/simple.jsp?pkgname=com.cjpoker.csnn";
                var appUrl="http://csnn.cjpoker.com/app/index.html";
                var title=vecArg[7]+"房间号:"+"["+this.mRoomID+"]";
                var text = "游戏类型: "+vecArg[7] + this.m_nRound + "/" + this.m_nMaxRound + "局  " + "[房主:" + dwc.Myself.GetData().GetNickName() +"]";
                obj.imageurl = iconUrl;
                obj.text = text;
                obj.title = title;
                obj.url = appUrl;
                jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "ShareToWeChat", "(Ljava/lang/String;)V", JSON.stringify(obj));
            }
            if (cc.sys.os == cc.sys.OS_IOS) {
                var iconUrl="http://img.cjpoker.com/csnn.png";
                //var appUrl="http://a.app.qq.com/o/simple.jsp?pkgname=com.cjpoker.csnn";
                var appUrl="http://csnn.cjpoker.com/csnn/index.html";
                var title=vecArg[7]+"房间号:"+"["+this.mRoomID+"]";

                jsb.reflection.callStaticMethod("RootViewController","OnSavePicWithName:shareType:shareContent:title:appUrl:text:iconUrl:","","wechat","auto",title,appUrl,title,iconUrl);
            }
            //var _url = "http://app.cjpoker.com/dbmj/share_invite.php?platform=wechat&type=default&uid=" + uid + "&roomid=" + roomid;
            //niuniu.GX_NetWorkManager.SendMessage(_url,
            //    function (_msg) {
            //        try {
            //            if (cc.sys.os == cc.sys.OS_ANDROID) {
            //                jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "ShareToWeChat", "(Ljava/lang/String;)V", _msg);
            //            } else if (cc.sys.os == cc.sys.OS_IOS) {
            //                var _msg_obj = JSON.parse(_msg);
            //                var title=_msg_obj.title;
            //                var text=_msg_obj.text;
            //                var iconUrl=_msg_obj.imageurl;
            //                var appUrl=_msg_obj.url;
            //                appUrl="http://a.app.qq.com/o/simple.jsp?pkgname=com.cjpoker.zujumj";
            //                jsb.reflection.callStaticMethod("RootViewController","OnSavePicWithName:shareType:shareContent:title:appUrl:text:iconUrl:","","wechat","auto",title,appUrl,text,iconUrl);
            //            }
            //        }catch (e)
            //        {
            //
            //        }
            //    });
        }catch (e)
        {
            cc.log(e.name + ":" + e.message);
        }
    },
});

dwc.FG_NIUNIU_Page = {
    roomType:"NIUNIU",
    target:null,
    init : function(mainNode,target)
    {
        this.opt = {};
        this.target = target;
        var that = this;

        var rootNode = $.getNodeByName(mainNode,"ID_NODE_OPT_NIUNIU");
        rootNode.setVisible(false);
        this.rootNode = rootNode;
        this.opt8juCheckBox=$.getNodeByName(rootNode,"ID_BUTTON_8JU");
        this.opt8juCheckBox.addEventListener(function (sender,type) {
            that.On8juCheckBox(sender,type);
        },this);
        this.opt8juLabel=$.getNodeByName(rootNode,"ID_LABEL_8JU_TEXT");

        this.opt16juCheckBox=$.getNodeByName(rootNode,"ID_BUTTON_16JU");
        this.opt16juCheckBox.addEventListener(function (sender,type) {
            that.On16juCheckBox(sender,type);
        },this);
        this.opt16juLabel=$.getNodeByName(rootNode,"ID_LABEL_16JU_TEXT");

        var cjfjBtn=$.getNodeByName(rootNode,"ID_BUTTON_CJFJ");
        cjfjBtn.addClickEventListener(function () {
            that.OnCreateRoomBtnClick();

        });
        this.On8juCheckBox();
    },
    setVisible : function(bVisible)
    {
        this.rootNode.setVisible(bVisible);
    },
    OnCreateRoomBtnClick : function()
    {
        var that=this;
        if(dwc.Myself.GetMyRoom())
        {
            that.OnFanHuiRoom();
            return;
        }
        var minNumGem=1;

        if(this.jushu=="8JU")
        {
            minNumGem=1;
        }else  if(this.jushu=="16JU")
        {
            minNumGem=2;
        }

        //minNumGem=100;
        if(dwc.Myself.GetData().GetGem()>=minNumGem)
        {
            //that.ShowLoading(true);

            var keys = [];
            for(var key in this.opt)
            {
                keys.push(key);
            }
            dwc.DT_Data_Login.SendCreateRoom(that.roomType,keys.join(";"),"1");
            that.target.Close();
        }else {
            this.OnShowHint("房卡不足,请充值或联系代理");
        }
        if(this.target)
        {
            this.target.Close();
        }
    },
    On8juCheckBox: function (sender , CheckBoxType) {
        this.opt8juCheckBox.setSelected(true);
        this.opt8juLabel.setColor(cc.color.GREEN);
        this.opt16juCheckBox.setSelected(false);
        this.opt16juLabel.setColor(cc.color.WHITE);
        this.jushu="8JU";
        this.opt["8JU"] = true;
        delete this.opt["16JU"];

    },
    On16juCheckBox: function (sender , CheckBoxType) {
        this.opt16juCheckBox.setSelected(true);
        //this.opt16juLabel.setColor(cc.color.GREEN);
        this.opt8juCheckBox.setSelected(false);
        //this.opt8juLabel.setColor(cc.color.WHITE);
        this.jushu="16JU";
        this.opt["16JU"] = true;
        delete this.opt["8JU"];
        cc.log(this.opt);

    },
};
dwc.FG_ZJH_Page = {
    roomType:"ZJH",
    target:null,
    init : function(mainNode,target)
    {
        this.opt = {};
        this.target = target;
        this.opt = {};
        var that = this;
        var rootNode = $.getNodeByName(mainNode,"ID_NODE_OPT_ZJH");
        rootNode.setVisible(false);
        this.rootNode = rootNode;
        this.opt8juCheckBox=$.getNodeByName(rootNode,"ID_BUTTON_8JU");
        this.opt8juCheckBox.addEventListener(function (sender,type) {
            that.On8juCheckBox(sender,type);
        },this);
        this.opt8juLabel=$.getNodeByName(rootNode,"ID_LABEL_8JU_TEXT");

        this.opt16juCheckBox=$.getNodeByName(rootNode,"ID_BUTTON_16JU");
        this.opt16juCheckBox.addEventListener(function (sender,type) {
            that.On16juCheckBox(sender,type);
        },this);
        this.opt16juLabel=$.getNodeByName(rootNode,"ID_LABEL_16JU_TEXT");

        var optFD30CheckBox=this.optFD30CheckBox=$.getNodeByName(mainNode,"ID_BUTTON_FD30");
        optFD30CheckBox.addEventListener(function (sender,type) {
            that.OnFD30CheckBox(sender,type);
        },this);
        this.optFD30Text=$.getNodeByName(mainNode,"ID_LABEL_FD30_TEXT");

        var optFD50CheckBox=this.optFD50CheckBox=$.getNodeByName(mainNode,"ID_BUTTON_FD50");
        optFD50CheckBox.addEventListener(function (sender,type) {
            that.OnFD50CheckBox(sender,type);
        },this);
        this.optFD50Text=$.getNodeByName(mainNode,"ID_LABEL_FD50_TEXT");

        var cjfjBtn=$.getNodeByName(rootNode,"ID_BUTTON_CJFJ");
        cjfjBtn.addClickEventListener(function () {
            that.OnCreateRoomBtnClick();

        });
        this.On8juCheckBox();
        this.OnFD30CheckBox();
    },
    setVisible : function(bVisible)
    {
        this.rootNode.setVisible(bVisible);
    },
    OnCreateRoomBtnClick : function()
    {
        var that=this;
        if(dwc.Myself.GetMyRoom())
        {
            that.OnFanHuiRoom();
            return;
        }
        var minNumGem=1;

        if(this.jushu=="8JU")
        {
            minNumGem=1;
        }else  if(this.jushu=="16JU")
        {
            minNumGem=2;
        }

        //minNumGem=100;
        if(dwc.Myself.GetData().GetGem()>=minNumGem)
        {
            //that.ShowLoading(true);

            var keys = [];
            for(var key in this.opt)
            {
                keys.push(key);
            }
            dwc.DT_Data_Login.SendCreateRoom(that.roomType,keys.join(";"),"1");

            that.target.Close();
        }else {
            this.OnShowHint("房卡不足,请充值或联系代理");
        }
        if(this.target)
        {
            this.target.Close();
        }
    },
    On8juCheckBox: function (sender , CheckBoxType) {
        this.opt8juCheckBox.setSelected(true);
        this.opt8juLabel.setColor(cc.color.GREEN);
        this.opt16juCheckBox.setSelected(false);
        this.opt16juLabel.setColor(cc.color.WHITE);
        this.jushu="8JU";
        this.opt["8JU"] = true;
        delete this.opt["16JU"];

    },
    On16juCheckBox: function (sender , CheckBoxType) {
        this.opt16juCheckBox.setSelected(true);
        this.opt16juLabel.setColor(cc.color.GREEN);
        this.opt8juCheckBox.setSelected(false);
        this.opt8juLabel.setColor(cc.color.WHITE);
        this.jushu="16JU";
        this.opt["16JU"] = true;
        delete this.opt["8JU"];
        cc.log(this.opt);

    },
    OnFD30CheckBox: function (sender , CheckBoxType) {
        this.optFD30CheckBox.setSelected(true);
        this.optFD30Text.setColor(cc.color.GREEN);
        this.optFD50CheckBox.setSelected(false);
        this.optFD50Text.setColor(cc.color.WHITE);
        this.opt8juLabel.setString("8局（房卡x1）");
        this.opt16juLabel.setString("16局（房卡x2）");

        this.opt["FD30"] = true;
        delete this.opt["FD50"];
    },
    OnFD50CheckBox: function (sender , CheckBoxType) {
        this.optFD50CheckBox.setSelected(true);
        this.optFD50Text.setColor(cc.color.GREEN);
        this.optFD30CheckBox.setSelected(false);
        this.optFD30Text.setColor(cc.color.WHITE);
        //this.optCostX2DescLabel.setString("提示：房卡消耗翻倍");

        this.opt8juLabel.setString("8局（房卡x2）");
        this.opt16juLabel.setString("16局（房卡x4）");

        this.opt["FD50"] = true;
        delete this.opt["FD30"];

        //this.OnWinPayCheckBox(null,null);
    },
};





dwc.DLZhanJiDialog=dwc.CommonAlertView.extend({
    ctor: function (target) {
        this._super();
        this.target = target;
        this.initUI();
    },
    initUI: function () {
        var that = this;
        var mainNode = ccs.load(dwc.g_arrGCRes.dt_zhanji_json).node;
        this.addChild(mainNode);
        this.noMsgLabel=$.getNodeByName(mainNode,"ID_LABLE_NOMSG");

        var closeBtn=$.getNodeByName(mainNode,"ID_BUTTON_CLOSE");
        closeBtn.addClickEventListener(function () {
            that.Close();
        });
        dwc.GX_NetWorkManager.SendMessage("http://csnn.cjpoker.com/app/battle_api.php?a=ninedt_battle_log_creator&uid=" + dwc.Myself.GetData().GetUid(),
            function (_msg) {
                that.message=JSON.parse(_msg);
                that.initTable(mainNode);
            });
    },
    initTable: function (mainNode)
    {
        if(this.message && this.message.data && this.message.data.length > 0)
        {
            this.noMsgLabel.setVisible(false);
        }
        this.tableBack=$.getNodeByName(mainNode,"ID_LAYOUT_TABLEBG");

        this.tableView=new cc.TableView(this,cc.size(1200,620));
        this.tableView.setDirection(cc.SCROLLVIEW_DIRECTION_VERTICAL);
        this.tableView.setDelegate(this);
        this.tableView.setVerticalFillOrder(cc.TABLEVIEW_FILL_TOPDOWN);
        this.tableBack.addChild(this.tableView);
        this.tableView.reloadData();
    },
    tableCellTouched:function (table, cell) {

        /*
         cc.log("cell touched at index: " + cell.getIdx());
         var index=cell.getIdx()+1;

         var detail=new dwc.DT_ZhanJiDetail();
         this.addChild(detail);
         detail.Show();
         */
    },
    tableCellSizeForIndex:function(table, idx){
        return cc.size(1200,180);
    },
    tableCellAtIndex:function (table, idx) {
        var cell=table.dequeueCell();
        if (!cell){
            cell=new dwc.ZhanJiCell(idx,this.message.data);
        }else {
            cell.refresh(idx,this.message.data);
        }
        return cell;
    },
    numberOfCellsInTableView:function (table) {

        return this.message.data.length;
    },
});



dwc.FGTuiDaoHu_Page = {
    roomType:"TUIDAOHU",
    setTarget : function(target)
    {
        this.target = target;
    },
    init : function(mainNode){
        this.opt = {};
        var that = this;
        var rootNode = $.getNodeByName(mainNode,"ID_NODE_OPT_TUIDAOHU");
        rootNode.setVisible(false);
        this.rootNode = rootNode;
        this.opt8juCheckBox=$.getNodeByName(rootNode,"ID_BUTTON_8JU");
        this.opt8juCheckBox.addEventListener(function (sender,type) {
            that.On8juCheckBox(sender,type);
        },this);
        this.opt8juLabel=$.getNodeByName(rootNode,"ID_LABEL_8JU_TEXT");

        this.opt16juCheckBox=$.getNodeByName(rootNode,"ID_BUTTON_16JU");
        this.opt16juCheckBox.addEventListener(function (sender,type) {
            that.On16juCheckBox(sender,type);
        },this);
        this.opt16juLabel=$.getNodeByName(rootNode,"ID_LABEL_16JU_TEXT");

        this.optGuiX0CheckBox=$.getNodeByName(rootNode,"ID_BUTTON_GUIX0");
        this.optGuiX0CheckBox.addEventListener(function (sender,type) {
            that.OnGuiX0CheckBox(sender,type);
        },this);
        this.optGuiX0Text=$.getNodeByName(rootNode,"ID_LABEL_GUIX0_TEXT");

        this.optGuiX1CheckBox=$.getNodeByName(rootNode,"ID_BUTTON_GUIX1");
        this.optGuiX1CheckBox.addEventListener(function (sender,type) {
            that.OnGuiX1CheckBox(sender,type);
        },this);
        this.optGuiX1Text=$.getNodeByName(rootNode,"ID_LABEL_GUIX1_TEXT");

        this.optGuiX2CheckBox=$.getNodeByName(rootNode,"ID_BUTTON_GUIX2");
        this.optGuiX2CheckBox.addEventListener(function (sender,type) {
            that.OnGuiX2CheckBox(sender,type);
        },this);
        this.optGuiX2Text=$.getNodeByName(rootNode,"ID_LABEL_GUIX2_TEXT");

        this.optMaX0CheckBox=$.getNodeByName(rootNode,"ID_BUTTON_MAX0");
        this.optMaX0CheckBox.addEventListener(function (sender,type) {
            that.OnMaX0CheckBox(sender,type);
        },this);
        this.optMaX0Text=$.getNodeByName(rootNode,"ID_LABEL_MAX0_TEXT");

        this.optMaX2CheckBox=$.getNodeByName(rootNode,"ID_BUTTON_MAX2");
        this.optMaX2CheckBox.addEventListener(function (sender,type) {
            that.OnMaX2CheckBox(sender,type);
        },this);
        this.optMaX2Text=$.getNodeByName(rootNode,"ID_LABEL_MAX2_TEXT");

        this.optMaX6CheckBox=$.getNodeByName(rootNode,"ID_BUTTON_MAX6");
        this.optMaX6CheckBox.addEventListener(function (sender,type) {
            that.OnMaX6CheckBox(sender,type);
        },this);
        this.optMaX6Text=$.getNodeByName(rootNode,"ID_LABEL_MAX6_TEXT");

        var cjfjBtn=$.getNodeByName(rootNode,"ID_BUTTON_CJFJ");
        cjfjBtn.addClickEventListener(function () {
            that.OnCreateRoomBtnClick();

        });
        this.On8juCheckBox();
        this.OnGuiX0CheckBox();
        this.OnMaX6CheckBox();
    },
    setVisible : function(bVisible)
    {
        this.rootNode.setVisible(bVisible);
    },
    OnCreateRoomBtnClick : function()
    {
        var that=this;
        if(dwc.Myself.GetMyRoom())
        {
            that.OnFanHuiRoom();
            return;
        }
        var minNumGem=1;

        if(this.jushu=="8JU")
        {
            minNumGem=1;
        }else  if(this.jushu=="16JU")
        {
            minNumGem=2;
        }

        if(dwc.Myself.GetData().GetGem()>=10)
        {
            //that.ShowLoading(true);

            var keys = [];
            for(var key in this.opt)
            {
                keys.push(key);
            }
            dwc.DT_Data_Login.SendCreateRoom(that.roomType,keys.join(";"),"1");
            that.target.Close();
        }else {
            if(this.target)
                this.target.OnShowHint("房卡低于10张不能使用此功能,请联系代理");
        }
    },
    On8juCheckBox: function (sender , CheckBoxType) {
        this.opt8juCheckBox.setSelected(true);
        //this.opt8juLabel.setColor(cc.color.GREEN);
        this.opt16juCheckBox.setSelected(false);
        //this.opt16juLabel.setColor(cc.color.WHITE);
        this.jushu="8JU";
        this.opt["8JU"] = true;
        delete this.opt["16JU"];

    },
    On16juCheckBox: function (sender , CheckBoxType) {
        this.opt16juCheckBox.setSelected(true);
        //this.opt16juLabel.setColor(cc.color.GREEN);
        this.opt8juCheckBox.setSelected(false);
        //this.opt8juLabel.setColor(cc.color.WHITE);
        this.jushu="16JU";
        this.opt["16JU"] = true;
        delete this.opt["8JU"];
        cc.log(this.opt);

    },

    OnGuiX0CheckBox: function (sender , CheckBoxType) {
        this.optGuiX0CheckBox.setSelected(true);
        //this.optGuiX0Text.setColor(cc.color.GREEN);
        this.optGuiX1CheckBox.setSelected(false);
        //this.optGuiX1Text.setColor(cc.color.GREEN);
        this.optGuiX2CheckBox.setSelected(false);
        //this.optGuiX2Text.setColor(cc.color.GREEN);

        this.opt["GUIX0"] = true;
        delete this.opt["GUIX1"];
        delete this.opt["GUIX2"];
    },
    OnGuiX1CheckBox: function (sender , CheckBoxType) {
        this.optGuiX0CheckBox.setSelected(false);
        //this.optGuiX0Text.setColor(cc.color.GREEN);
        this.optGuiX1CheckBox.setSelected(true);
        //this.optGuiX1Text.setColor(cc.color.GREEN);
        this.optGuiX2CheckBox.setSelected(false);
        //this.optGuiX2Text.setColor(cc.color.GREEN);

        this.opt["GUIX1"] = true;
        delete this.opt["GUIX0"];
        delete this.opt["GUIX2"];
    },
    OnGuiX2CheckBox: function (sender , CheckBoxType) {
        this.optGuiX0CheckBox.setSelected(false);
        //this.optGuiX0Text.setColor(cc.color.GREEN);
        this.optGuiX1CheckBox.setSelected(false);
        //this.optGuiX1Text.setColor(cc.color.GREEN);
        this.optGuiX2CheckBox.setSelected(true);
        //this.optGuiX2Text.setColor(cc.color.GREEN)

        this.opt["GUIX2"] = true;
        delete this.opt["GUIX0"];
        delete this.opt["GUIX1"];
    },
    OnMaX0CheckBox: function (sender , CheckBoxType) {
        this.optMaX0CheckBox.setSelected(true);
        //this.optMaX0Text.setColor(cc.color.GREEN);
        this.optMaX2CheckBox.setSelected(false);
        //this.optMaX2Text.setColor(cc.color.GREEN);
        this.optMaX6CheckBox.setSelected(false);
        //this.optMaX6Text.setColor(cc.color.GREEN);

        this.opt["MAX0"] = true;
        delete this.opt["MAX2"];
        delete this.opt["MAX6"];
    },
    OnMaX2CheckBox: function (sender , CheckBoxType) {
        this.optMaX0CheckBox.setSelected(false);
        //this.optMaX0Text.setColor(cc.color.GREEN);
        this.optMaX2CheckBox.setSelected(true);
        //this.optMaX2Text.setColor(cc.color.GREEN);
        this.optMaX6CheckBox.setSelected(false);
        //this.optMaX6Text.setColor(cc.color.GREEN);

        this.opt["MAX2"] = true;
        delete this.opt["MAX0"];
        delete this.opt["MAX4"];
        delete this.opt["MAX6"];
    },
    OnMaX4CheckBox: function (sender , CheckBoxType) {
        this.optMaX0CheckBox.setSelected(false);
        //this.optMaX0Text.setColor(cc.color.GREEN);
        this.optMaX2CheckBox.setSelected(false);
        //this.optMaX2Text.setColor(cc.color.GREEN);
        this.optMaX6CheckBox.setSelected(false);
        //this.optMaX6Text.setColor(cc.color.GREEN);

        this.opt["MAX4"] = true;
        delete this.opt["MAX0"];
        delete this.opt["MAX4"];
        delete this.opt["MAX6"];
    },
    OnMaX6CheckBox: function (sender , CheckBoxType) {
        this.optMaX0CheckBox.setSelected(false);
        //this.optMaX0Text.setColor(cc.color.GREEN);
        this.optMaX2CheckBox.setSelected(false);
        //this.optMaX2Text.setColor(cc.color.GREEN);
        this.optMaX6CheckBox.setSelected(true);
        //this.optMaX6Text.setColor(cc.color.GREEN);

        this.opt["MAX6"] = true;
        delete this.opt["MAX0"];
        delete this.opt["MAX2"];
        delete this.opt["MAX4"];
    },
};
dwc.FGJIPINGHU_Page = {
    roomType:"JIPINGHU",
    setTarget : function(target)
    {
        this.target = target;
    },
    init : function(mainNode)
    {
        this.opt = {};
        var that = this;
        var rootNode = $.getNodeByName(mainNode,"ID_NODE_OPT_JIPINGHU");
        rootNode.setVisible(false);
        this.rootNode = rootNode;
        this.opt8juCheckBox=$.getNodeByName(rootNode,"ID_BUTTON_8JU");
        this.opt8juCheckBox.addEventListener(function (sender,type) {
            that.On8juCheckBox(sender,type);
        },this);
        this.opt8juLabel=$.getNodeByName(rootNode,"ID_LABEL_8JU_TEXT");

        this.opt16juCheckBox=$.getNodeByName(rootNode,"ID_BUTTON_16JU");
        this.opt16juCheckBox.addEventListener(function (sender,type) {
            that.On16juCheckBox(sender,type);
        },this);
        this.opt16juLabel=$.getNodeByName(rootNode,"ID_LABEL_16JU_TEXT");

        this.optFANX0CheckBox=$.getNodeByName(rootNode,"ID_BUTTON_FANX0");
        this.optFANX0CheckBox.addEventListener(function (sender,type) {
            that.OnFANX0CheckBox(sender,type);
        },this);
        this.optFANX0Text=$.getNodeByName(rootNode,"ID_LABEL_FANX0_TEXT");

        this.optFANX1CheckBox=$.getNodeByName(rootNode,"ID_BUTTON_FANX1");
        this.optFANX1CheckBox.addEventListener(function (sender,type) {
            that.OnFANX1CheckBox(sender,type);
        },this);
        this.optFANX1Text=$.getNodeByName(rootNode,"ID_LABEL_FANX1_TEXT");

        this.optFANX3CheckBox=$.getNodeByName(rootNode,"ID_BUTTON_FANX3");
        this.optFANX3CheckBox.addEventListener(function (sender,type) {
            that.OnFANX3CheckBox(sender,type);
        },this);
        this.optFANX3Text=$.getNodeByName(rootNode,"ID_LABEL_FANX3_TEXT");

        var cjfjBtn=$.getNodeByName(rootNode,"ID_BUTTON_CJFJ");
        cjfjBtn.addClickEventListener(function () {
            that.OnCreateRoomBtnClick();

        });
        this.On8juCheckBox();
    },
    setVisible : function(bVisible)
    {
        this.rootNode.setVisible(bVisible);
    },
    OnCreateRoomBtnClick : function()
    {
        var that=this;
        if(dwc.Myself.GetMyRoom())
        {
            that.OnFanHuiRoom();
            return;
        }
        var minNumGem=1;

        if(this.jushu=="8JU")
        {
            minNumGem=1;
        }else  if(this.jushu=="16JU")
        {
            minNumGem=2;
        }

        if(dwc.Myself.GetData().GetGem()>=10)
        {
            //that.ShowLoading(true);

            var keys = [];
            for(var key in this.opt)
            {
                keys.push(key);
            }
            dwc.DT_Data_Login.SendCreateRoom(that.roomType,keys.join(";"),"1");
            that.target.Close();
        }else {
            if(this.target)
                this.target.OnShowHint("房卡低于10张不能使用此功能,请联系代理");
        }
    },
    On8juCheckBox: function (sender , CheckBoxType) {
        this.opt8juCheckBox.setSelected(true);
        //this.opt8juLabel.setColor(cc.color.GREEN);
        this.opt16juCheckBox.setSelected(false);
        //this.opt16juLabel.setColor(cc.color.WHITE);
        this.jushu="8JU";
        this.opt["8JU"] = true;
        delete this.opt["16JU"];

    },
    On16juCheckBox: function (sender , CheckBoxType) {
        this.opt16juCheckBox.setSelected(true);
        //this.opt16juLabel.setColor(cc.color.GREEN);
        this.opt8juCheckBox.setSelected(false);
        //this.opt8juLabel.setColor(cc.color.WHITE);
        this.jushu="16JU";
        this.opt["16JU"] = true;
        delete this.opt["8JU"];
        cc.log(this.opt);

    },

    OnFANX0CheckBox: function (sender , CheckBoxType) {
        this.optFANX0CheckBox.setSelected(true);
        //this.optFANX0Text.setColor(cc.color.GREEN);
        this.optFANX1CheckBox.setSelected(false);
        //this.optFANX1Text.setColor(cc.color.GREEN);
        this.optFANX3CheckBox.setSelected(false);
        //this.optFANX3Text.setColor(cc.color.GREEN);

        this.opt["FANX0"] = true;
        delete this.opt["FANX1"];
        delete this.opt["FANX3"];
    },
    OnFANX1CheckBox: function (sender , CheckBoxType) {
        this.optFANX0CheckBox.setSelected(false);
        //this.optFANX0Text.setColor(cc.color.GREEN);
        this.optFANX1CheckBox.setSelected(true);
        //this.optFANX1Text.setColor(cc.color.GREEN);
        this.optFANX3CheckBox.setSelected(false);
        //this.optFANX3Text.setColor(cc.color.GREEN);

        this.opt["FANX1"] = true;
        delete this.opt["FANX0"];
        delete this.opt["FANX3"];
    },
    OnFANX3CheckBox: function (sender , CheckBoxType) {
        this.optFANX0CheckBox.setSelected(false);
        //this.optFANX0Text.setColor(cc.color.GREEN);
        this.optFANX1CheckBox.setSelected(false);
        //this.optFANX1Text.setColor(cc.color.GREEN);
        this.optFANX3CheckBox.setSelected(true);
        //this.optFANX3Text.setColor(cc.color.GREEN)

        this.opt["FANX3"] = true;
        delete this.opt["FANX0"];
        delete this.opt["FANX1"];
    },
};
dwc.FGGBMJ_Page = {
    roomType:"GBMJ",
    setTarget : function(target)
    {
        this.target = target;
    },
    init : function(mainNode)
    {
        this.opt = {};
        var that = this;
        var rootNode = $.getNodeByName(mainNode,"ID_NODE_OPT_GBMJ");
        rootNode.setVisible(false);
        this.rootNode = rootNode;
        this.opt8juCheckBox=$.getNodeByName(rootNode,"ID_BUTTON_8JU");
        this.opt8juCheckBox.addEventListener(function (sender,type) {
            that.On8juCheckBox(sender,type);
        },this);
        this.opt8juLabel=$.getNodeByName(rootNode,"ID_LABEL_8JU_TEXT");

        this.opt16juCheckBox=$.getNodeByName(rootNode,"ID_BUTTON_16JU");
        this.opt16juCheckBox.addEventListener(function (sender,type) {
            that.On16juCheckBox(sender,type);
        },this);
        this.opt16juLabel=$.getNodeByName(rootNode,"ID_LABEL_16JU_TEXT");

        var cjfjBtn=$.getNodeByName(rootNode,"ID_BUTTON_CJFJ");
        cjfjBtn.addClickEventListener(function () {
            that.OnCreateRoomBtnClick();

        });
        this.On8juCheckBox();
    },
    setVisible : function(bVisible)
    {
        this.rootNode.setVisible(bVisible);
    },
    OnCreateRoomBtnClick : function()
    {
        var that=this;
        if(dwc.Myself.GetMyRoom())
        {
            that.OnFanHuiRoom();
            return;
        }
        var minNumGem=1;

        if(this.jushu=="8JU")
        {
            minNumGem=1;
        }else  if(this.jushu=="16JU")
        {
            minNumGem=2;
        }

        if(dwc.Myself.GetData().GetGem()>=10)
        {
            //that.ShowLoading(true);

            var keys = [];
            for(var key in this.opt)
            {
                keys.push(key);
            }
            dwc.DT_Data_Login.SendCreateRoom(that.roomType,keys.join(";"),"1");
            that.target.Close();
        }else {
            if(this.target)
                this.target.OnShowHint("房卡低于10张不能使用此功能,请联系代理");
        }
    },
    On8juCheckBox: function (sender , CheckBoxType) {
        this.opt8juCheckBox.setSelected(true);
        //this.opt8juLabel.setColor(cc.color.GREEN);
        this.opt16juCheckBox.setSelected(false);

        //this.opt16juLabel.setColor(cc.color.WHITE);
        this.jushu="8JU";
        this.opt["8JU"] = true;
        delete this.opt["16JU"];

    },
    On16juCheckBox: function (sender , CheckBoxType) {
        this.opt16juCheckBox.setSelected(true);
        //this.opt16juLabel.setColor(cc.color.GREEN);
        this.opt8juCheckBox.setSelected(false);
        //this.opt8juLabel.setColor(cc.color.WHITE);
        this.jushu="16JU";
        this.opt["16JU"] = true;
        delete this.opt["8JU"];
        cc.log(this.opt);

    },
};
dwc.FGXLCH_Page = {
    roomType:"XLCH",
    setTarget : function(target)
    {
        this.target = target;
    },
    init : function(mainNode)
    {
        this.opt = {};
        var that = this;
        var rootNode = $.getNodeByName(mainNode,"ID_NODE_OPT_XLCH");
        rootNode.setVisible(false);
        this.rootNode = rootNode;
        this.opt3juCheckBox=$.getNodeByName(rootNode,"ID_BUTTON_3JU");
        this.opt3juCheckBox.addEventListener(function (sender,type) {
            that.On3juCheckBox(sender,type);
        },this);
        this.opt3juLabel=$.getNodeByName(rootNode,"ID_LABEL_3JU_TEXT");

        this.opt6juCheckBox=$.getNodeByName(rootNode,"ID_BUTTON_6JU");
        this.opt6juCheckBox.addEventListener(function (sender,type) {
            that.On6juCheckBox(sender,type);
        },this);
        this.opt6juLabel=$.getNodeByName(rootNode,"ID_LABEL_6JU_TEXT");

        var cjfjBtn=$.getNodeByName(rootNode,"ID_BUTTON_CJFJ");
        cjfjBtn.addClickEventListener(function () {
            that.OnCreateRoomBtnClick();

        });
        this.On3juCheckBox();
    },
    setVisible : function(bVisible)
    {
        this.rootNode.setVisible(bVisible);
    },
    OnCreateRoomBtnClick : function()
    {
        var that=this;
        if(dwc.Myself.GetMyRoom())
        {
            that.OnFanHuiRoom();
            return;
        }
        var minNumGem=1;

        if(this.jushu=="3JU")
        {
            minNumGem=1;
        }else  if(this.jushu=="6JU")
        {
            minNumGem=2;
        }

        if(dwc.Myself.GetData().GetGem()>=10)
        {
            //that.ShowLoading(true);

            var keys = [];
            for(var key in this.opt)
            {
                keys.push(key);
            }
            dwc.DT_Data_Login.SendCreateRoom(that.roomType,keys.join(";"),"1");
            that.target.Close();
        }else {
            if(this.target)
                this.target.OnShowHint("房卡低于10张不能使用此功能,请联系代理");
        }
    },
    On3juCheckBox: function (sender , CheckBoxType) {
        this.opt3juCheckBox.setSelected(true);
        //this.opt3juLabel.setColor(cc.color.GREEN);
        this.opt6juCheckBox.setSelected(false);
        //this.opt6juLabel.setColor(cc.color.WHITE);
        this.jushu="3JU";
        this.opt["3JU"] = true;
        delete this.opt["6JU"];

    },
    On6juCheckBox: function (sender , CheckBoxType) {
        this.opt6juCheckBox.setSelected(true);
        //this.opt6juLabel.setColor(cc.color.GREEN);
        this.opt3juCheckBox.setSelected(false);
        //this.opt3juLabel.setColor(cc.color.WHITE);
        this.jushu="6JU";
        this.opt["6JU"] = true;
        delete this.opt["3JU"];
        cc.log(this.opt);

    },
};

dwc.FGJHMJ_Page = {
    roomType:"JHMJ",
    setTarget : function(target)
    {
        this.target = target;
    },
    init : function(mainNode)
    {
        this.opt = {};
        var that = this;
        var rootNode = $.getNodeByName(mainNode,"ID_NODE_OPT_JHMJ");
        rootNode.setVisible(false);
        this.rootNode = rootNode;

        this.nodeFen = $.getNodeByName(rootNode,"ID_NODE_OPT_FEN");
        this.nodeFen.setVisible(false);

        this.nodeJU = $.getNodeByName(rootNode,"ID_NODE_OPT_JU");
        this.nodeJU.setVisible(false);

        this.optDaKunCheckBox=$.getNodeByName(rootNode,"ID_BUTTON_DAKUN");
        this.optDaKunCheckBox.addEventListener(function (sender,type) {
            that.OnDaKunCheckBox(sender,type);
        },this);
        this.optDaKunLabel=$.getNodeByName(rootNode,"ID_LABEL_DAKUN_TEXT");

        this.optChangPaoCheckBox=$.getNodeByName(rootNode,"ID_BUTTON_CHANGPAO");
        this.optChangPaoCheckBox.addEventListener(function (sender,type) {
            that.OnChangPaoCheckBox(sender,type);
        },this);
        this.optChangPaoLabel=$.getNodeByName(rootNode,"ID_LABEL_CHANGPAO_TEXT");

        this.opt8juCheckBox=$.getNodeByName(rootNode,"ID_BUTTON_8JU");
        this.opt8juCheckBox.addEventListener(function (sender,type) {
            that.On8juCheckBox(sender,type);
        },this);
        this.opt8juLabel=$.getNodeByName(rootNode,"ID_LABEL_8JU_TEXT");

        this.opt16juCheckBox=$.getNodeByName(rootNode,"ID_BUTTON_16JU");
        this.opt16juCheckBox.addEventListener(function (sender,type) {
            that.On16juCheckBox(sender,type);
        },this);
        this.opt16juLabel=$.getNodeByName(rootNode,"ID_LABEL_16JU_TEXT");


        this.optDI36CheckBox=$.getNodeByName(rootNode,"ID_BUTTON_DI36");
        this.optDI36CheckBox.addEventListener(function (sender, type) {
            that.OnDI36CheckBox(sender,type);
        },this);
        this.optQiZhuang36Text=$.getNodeByName(rootNode,"ID_LABEL_DI36_TEXT");

        this.optDI48CheckBox=$.getNodeByName(rootNode,"ID_BUTTON_DI48");
        this.optDI48CheckBox.addEventListener(function (sender, type) {
            that.OnDI48CheckBox(sender,type);
        },this);
        this.optDI48Text=$.getNodeByName(rootNode,"ID_LABEL_DI48_TEXT");

        this.optFD40CheckBox=$.getNodeByName(rootNode,"ID_BUTTON_FD40");
        this.optFD40CheckBox.addEventListener(function (sender,type) {
            that.OnFD40CheckBox(sender,type);
        },this);
        this.optFD40Label=$.getNodeByName(rootNode,"ID_LABEL_FD40_TEXT");

        this.optFD50CheckBox=$.getNodeByName(rootNode,"ID_BUTTON_FD50");
        this.optFD50CheckBox.addEventListener(function (sender,type) {
            that.OnFD50CheckBox(sender,type);
        },this);
        this.optFD50Label=$.getNodeByName(rootNode,"ID_LABEL_FD50_TEXT");

        var cjfjBtn=$.getNodeByName(rootNode,"ID_BUTTON_CJFJ");
        cjfjBtn.addClickEventListener(function () {
            that.OnCreateRoomBtnClick();

        });
        this.OnDaKunCheckBox();
        this.On8juCheckBox();
        this.OnDI36CheckBox();
        this.OnFD40CheckBox();
    },
    setVisible : function(bVisible)
    {
        this.rootNode.setVisible(bVisible);
    },
    OnCreateRoomBtnClick : function()
    {
        var that=this;
        if(dwc.Myself.GetMyRoom())
        {
            that.OnFanHuiRoom();
            return;
        }
        var minNumGem=1;

        if(this.opt["8JU"])
        {
            minNumGem=2;
        }else  if(this.opt["16JU"])
        {
            minNumGem=4;
        }

        //minNumGem=100;
        if(dwc.Myself.GetData().GetGem()>=10)
        {
            //that.ShowLoading(true);

            var keys = [];
            for(var key in this.opt)
            {
                keys.push(key);
            }
            dwc.DT_Data_Login.SendCreateRoom(that.roomType,keys.join(";"),"1");
            that.target.Close();
        }else {
            if(this.target)
                this.target.OnShowHint("房卡低于10张不能使用此功能,请联系代理");
        }
    },
    OnDaKunCheckBox: function (sender , CheckBoxType) {
        this.optDaKunCheckBox.setSelected(true);
        //this.opt8juLabel.setColor(cc.color.GREEN);

        this.optChangPaoCheckBox.setSelected(false);
        //this.opt16juLabel.setColor(cc.color.WHITE);

        this.nodeFen.setVisible(true);
        this.nodeJU.setVisible(false);
        this.opt["DAKUN"] = true;
        delete this.opt["CHANGPAO"];

    },
    OnChangPaoCheckBox: function (sender , CheckBoxType) {
        this.optChangPaoCheckBox.setSelected(true);
        //this.opt16juLabel.setColor(cc.color.GREEN);

        this.optDaKunCheckBox.setSelected(false);
        //this.opt8juLabel.setColor(cc.color.WHITE);
        this.nodeFen.setVisible(false);
        this.nodeJU.setVisible(true);
        this.opt["CHANGPAO"] = true;
        delete this.opt["DAKUN"];

    },
    OnFD40CheckBox: function (sender , CheckBoxType)
    {
        this.optFD40CheckBox.setSelected(true);
        //this.opt8juLabel.setColor(cc.color.GREEN);
        this.optFD50CheckBox.setSelected(false);
        //this.opt16juLabel.setColor(cc.color.WHITE);

        this.opt["FD40"] = true;
        delete this.opt["FD50"];

    },
    OnFD50CheckBox: function (sender , CheckBoxType)
    {

        this.optFD50CheckBox.setSelected(true);
        //this.opt16juLabel.setColor(cc.color.GREEN);
        this.optFD40CheckBox.setSelected(false);
        //this.opt8juLabel.setColor(cc.color.WHITE);

        this.opt["FD50"] = true;
        delete this.opt["FD40"];

    },
    On8juCheckBox: function (sender , CheckBoxType) {
        this.opt8juCheckBox.setSelected(true);
        //this.opt8juLabel.setTextColor(cc.color.RED);
        this.opt16juCheckBox.setSelected(false);
        //this.opt16juLabel.setTextColor(cc.color.WHITE);

        this.opt["8JU"] = true;
        delete this.opt["16JU"];
    },
    On16juCheckBox: function (sender , CheckBoxType) {
        this.opt16juCheckBox.setSelected(true);
        //this.opt16juLabel.setTextColor(cc.color.RED);
        this.opt8juCheckBox.setSelected(false);
        //this.opt8juLabel.setTextColor(cc.color.WHITE);

        this.opt["16JU"] = true;
        delete this.opt["8JU"];
    },

    OnDI36CheckBox: function (sender , CheckBoxType) {
        this.optDI36CheckBox.setSelected(true);
        //this.optMoGuiText.setColor(cc.color.GREEN);
        this.optDI48CheckBox.setSelected(false);
        //this.optGuiX1Text.setColor(cc.color.GREEN);

        this.opt["DI36"] = true;
        delete this.opt["DI48"];
    },
    OnDI48CheckBox: function (sender , CheckBoxType) {
        this.optDI36CheckBox.setSelected(false);
        //this.optMoGuiText.setColor(cc.color.GREEN);
        this.optDI48CheckBox.setSelected(true);
        //this.optGuiX1Text.setColor(cc.color.GREEN);

        this.opt["DI48"] = true;
        delete this.opt["DI36"];
    },
};
dwc.FGCSMJ_Page = {
    roomType:"CSMJ",
    setTarget : function(target)
    {
        this.target = target;
    },
    init : function(mainNode)
    {
        this.opt = {};
        var that = this;
        var rootNode = $.getNodeByName(mainNode,"ID_NODE_OPT_CSMJ");
        rootNode.setVisible(false);
        this.rootNode = rootNode;

        this.opt8juCheckBox=$.getNodeByName(rootNode,"ID_BUTTON_8JU");
        this.opt8juCheckBox.addEventListener(function (sender,type) {
            that.On8juCheckBox(sender,type);
        },this);
        this.opt8juLabel=$.getNodeByName(rootNode,"ID_LABEL_8JU_TEXT");

        this.opt16juCheckBox=$.getNodeByName(rootNode,"ID_BUTTON_16JU");
        this.opt16juCheckBox.addEventListener(function (sender,type) {
            that.On16juCheckBox(sender,type);
        },this);
        this.opt16juLabel=$.getNodeByName(rootNode,"ID_LABEL_16JU_TEXT");


        this.optDI36CheckBox=$.getNodeByName(rootNode,"ID_BUTTON_DI36");
        this.optDI36CheckBox.addEventListener(function (sender, type) {
            that.OnDI36CheckBox(sender,type);
        },this);
        this.optDI36Text=$.getNodeByName(rootNode,"ID_LABEL_DI36_TEXT");

        this.optDI48CheckBox=$.getNodeByName(rootNode,"ID_BUTTON_DI48");
        this.optDI48CheckBox.addEventListener(function (sender, type) {
            that.OnDI48CheckBox(sender,type);
        },this);
        this.optDI48Text=$.getNodeByName(rootNode,"ID_LABEL_DI48_TEXT");
        

        var cjfjBtn=$.getNodeByName(rootNode,"ID_BUTTON_CJFJ");
        cjfjBtn.addClickEventListener(function () {
            that.OnCreateRoomBtnClick();

        });
        this.On8juCheckBox();
        this.OnDI36CheckBox();
    },
    setVisible : function(bVisible)
    {
        this.rootNode.setVisible(bVisible);
    },
    OnCreateRoomBtnClick : function()
    {
        var that=this;
        if(dwc.Myself.GetMyRoom())
        {
            that.OnFanHuiRoom();
            return;
        }
        var minNumGem=2;

        if(this.opt["8JU"])
        {
            minNumGem=2;
        }else  if(this.opt["16JU"])
        {
            minNumGem=4;
        }

        //minNumGem=100;
        if(dwc.Myself.GetData().GetGem()>=10)
        {
            //that.ShowLoading(true);

            var keys = [];
            for(var key in this.opt)
            {
                keys.push(key);
            }
            dwc.DT_Data_Login.SendCreateRoom(that.roomType,keys.join(";"),"1");
            that.target.Close();
        }else {
            if(this.target)
                this.target.OnShowHint("房卡低于10张不能使用此功能,请联系代理");
        }
    },
    On8juCheckBox: function (sender , CheckBoxType) {
        this.opt8juCheckBox.setSelected(true);
        //this.opt8juLabel.setTextColor(cc.color.RED);
        this.opt16juCheckBox.setSelected(false);
        //this.opt16juLabel.setTextColor(cc.color.WHITE);

        this.opt["8JU"] = true;
        delete this.opt["16JU"];
    },
    On16juCheckBox: function (sender , CheckBoxType) {
        this.opt16juCheckBox.setSelected(true);
        //this.opt16juLabel.setTextColor(cc.color.RED);
        this.opt8juCheckBox.setSelected(false);
        //this.opt8juLabel.setTextColor(cc.color.WHITE);

        this.opt["16JU"] = true;
        delete this.opt["8JU"];
    },

    OnDI36CheckBox: function (sender , CheckBoxType) {
        this.optDI36CheckBox.setSelected(true);
        //this.optMoGuiText.setColor(cc.color.GREEN);
        this.optDI48CheckBox.setSelected(false);
        //this.optGuiX1Text.setColor(cc.color.GREEN);

        this.opt["DI36"] = true;
        delete this.opt["DI48"];
    },
    OnDI48CheckBox: function (sender , CheckBoxType) {
        this.optDI36CheckBox.setSelected(false);
        //this.optMoGuiText.setColor(cc.color.GREEN);
        this.optDI48CheckBox.setSelected(true);
        //this.optGuiX1Text.setColor(cc.color.GREEN);

        this.opt["DI48"] = true;
        delete this.opt["DI36"];
    },
};
dwc.FGNBMJ_Page = {
    roomType:"NBMJ",
    setTarget : function(target)
    {
        this.target = target;
    },
    init : function(mainNode)
    {
        this.opt = {};
        var that = this;
        var rootNode = $.getNodeByName(mainNode,"ID_NODE_OPT_NBMJ");
        rootNode.setVisible(false);
        this.rootNode = rootNode;
        this.opt8juCheckBox=$.getNodeByName(rootNode,"ID_BUTTON_8JU");
        this.opt8juCheckBox.addEventListener(function (sender,type) {
            that.On8juCheckBox(sender,type);
        },this);
        this.opt8juLabel=$.getNodeByName(rootNode,"ID_LABEL_8JU_TEXT");

        this.opt16juCheckBox=$.getNodeByName(rootNode,"ID_BUTTON_16JU");
        this.opt16juCheckBox.addEventListener(function (sender,type) {
            that.On16juCheckBox(sender,type);
        },this);
        this.opt16juLabel=$.getNodeByName(rootNode,"ID_LABEL_16JU_TEXT");


        var cjfjBtn=$.getNodeByName(rootNode,"ID_BUTTON_CJFJ");
        cjfjBtn.addClickEventListener(function () {
            that.OnCreateRoomBtnClick();

        });
        this.On8juCheckBox();
    },
    setVisible : function(bVisible)
    {
        this.rootNode.setVisible(bVisible);
    },
    OnCreateRoomBtnClick : function()
    {
        var that=this;
        if(dwc.Myself.GetMyRoom())
        {
            that.OnFanHuiRoom();
            return;
        }
        var minNumGem=1;

        if(this.jushu=="8JU")
        {
            minNumGem=1;
        }else  if(this.jushu=="16JU")
        {
            minNumGem=2;
        }

        if(dwc.Myself.GetData().GetGem()>=10)
        {
            //that.ShowLoading(true);

            var keys = [];
            for(var key in this.opt)
            {
                keys.push(key);
            }
            dwc.DT_Data_Login.SendCreateRoom(that.roomType,keys.join(";"),"1");
            that.target.Close();
        }else {
            if(this.target)
                this.target.OnShowHint("房卡低于10张不能使用此功能,请联系代理");
        }
    },
    On8juCheckBox: function (sender , CheckBoxType) {
        this.opt8juCheckBox.setSelected(true);
        //this.opt8juLabel.setColor(cc.color.GREEN);
        this.opt16juCheckBox.setSelected(false);
        //this.opt16juLabel.setColor(cc.color.WHITE);
        this.jushu="8JU";
        this.opt["8JU"] = true;
        delete this.opt["16JU"];

    },
    On16juCheckBox: function (sender , CheckBoxType) {
        this.opt16juCheckBox.setSelected(true);
        //this.opt16juLabel.setColor(cc.color.GREEN);
        this.opt8juCheckBox.setSelected(false);
        //this.opt8juLabel.setColor(cc.color.WHITE);
        this.jushu="16JU";
        this.opt["16JU"] = true;
        delete this.opt["8JU"];
        cc.log(this.opt);

    },

};
dwc.FGZJH_Page = {
    roomType:"ZJH",
    setTarget : function(target)
    {
        this.target = target;
    },
    init : function(mainNode)
    {
        this.opt = {};
        var that = this;
        var rootNode = $.getNodeByName(mainNode,"ID_NODE_OPT_ZJH");
        rootNode.setVisible(false);
        this.rootNode = rootNode;
        this.opt8juCheckBox=$.getNodeByName(rootNode,"ID_BUTTON_8JU");
        this.opt8juCheckBox.addEventListener(function (sender,type) {
            that.On8juCheckBox(sender,type);
        },this);
        this.opt8juLabel=$.getNodeByName(rootNode,"ID_LABEL_8JU_TEXT");

        this.opt16juCheckBox=$.getNodeByName(rootNode,"ID_BUTTON_16JU");
        this.opt16juCheckBox.addEventListener(function (sender,type) {
            that.On16juCheckBox(sender,type);
        },this);
        this.opt16juLabel=$.getNodeByName(rootNode,"ID_LABEL_16JU_TEXT");

        var optFD30CheckBox=this.optFD30CheckBox=$.getNodeByName(rootNode,"ID_BUTTON_FD30");
        optFD30CheckBox.addEventListener(function (sender,type) {
            that.OnFD30CheckBox(sender,type);
        },this);
        this.optFD30Text=$.getNodeByName(rootNode,"ID_LABEL_FD30_TEXT");

        var optFD50CheckBox=this.optFD50CheckBox=$.getNodeByName(rootNode,"ID_BUTTON_FD50");
        optFD50CheckBox.addEventListener(function (sender,type) {
            that.OnFD50CheckBox(sender,type);
        },this);
        this.optFD50Text=$.getNodeByName(rootNode,"ID_LABEL_FD50_TEXT");


        var optFD100CheckBox=this.optFD100CheckBox=$.getNodeByName(rootNode,"ID_BUTTON_FD100");
        optFD100CheckBox.addEventListener(function (sender,type) {
            that.OnFD100CheckBox(sender,type);
        },this);
        this.optFD100Text=$.getNodeByName(rootNode,"ID_LABEL_FD100_TEXT");

        var cjfjBtn=$.getNodeByName(rootNode,"ID_BUTTON_CJFJ");
        cjfjBtn.addClickEventListener(function () {
            that.OnCreateRoomBtnClick();

        });
        this.On8juCheckBox();
        this.OnFD30CheckBox();
    },
    setVisible : function(bVisible)
    {
        this.rootNode.setVisible(bVisible);
    },
    OnCreateRoomBtnClick : function()
    {
        var that=this;
        if(dwc.Myself.GetMyRoom())
        {
            that.OnFanHuiRoom();
            return;
        }
        var minNumGem=1;

        if(this.jushu=="8JU")
        {
            minNumGem=1;
        }else  if(this.jushu=="16JU")
        {
            minNumGem=2;
        }

        if(dwc.Myself.GetData().GetGem()>=10)
        {
            //that.ShowLoading(true);

            var keys = [];
            for(var key in this.opt)
            {
                keys.push(key);
            }
            dwc.DT_Data_Login.SendCreateRoom(that.roomType,keys.join(";"),"1");
            that.target.Close();
        }else {
            if(this.target)
                this.target.OnShowHint("房卡低于10张不能使用此功能,请联系代理");
        }
    },
    On8juCheckBox: function (sender , CheckBoxType) {
        this.opt8juCheckBox.setSelected(true);
        //this.opt8juLabel.setColor(cc.color.GREEN);
        this.opt16juCheckBox.setSelected(false);
        //this.opt16juLabel.setColor(cc.color.WHITE);
        this.jushu="8JU";
        this.opt["8JU"] = true;
        delete this.opt["16JU"];

    },
    On16juCheckBox: function (sender , CheckBoxType) {
        this.opt16juCheckBox.setSelected(true);
        //this.opt16juLabel.setColor(cc.color.GREEN);
        this.opt8juCheckBox.setSelected(false);
        //this.opt8juLabel.setColor(cc.color.WHITE);
        this.jushu="16JU";
        this.opt["16JU"] = true;
        delete this.opt["8JU"];
        cc.log(this.opt);

    },
    OnFD30CheckBox: function (sender , CheckBoxType) {
        this.optFD30CheckBox.setSelected(true);
        //this.optFD30Text.setColor(cc.color.GREEN);
        this.optFD50CheckBox.setSelected(false);
        //this.optFD50Text.setColor(cc.color.WHITE);
        this.optFD100CheckBox.setSelected(false);
        //this.optFD100Text.setColor(cc.color.WHITE);
        this.opt8juLabel.setString("8局(房卡x1)");
        this.opt16juLabel.setString("16局(房卡x2)");

        this.opt["FD30"] = true;
        delete this.opt["FD10"];
        delete this.opt["FD50"];
        delete this.opt["FD100"];
        //this.renew_desc();
    },
    OnFD50CheckBox: function (sender , CheckBoxType) {
        this.optFD50CheckBox.setSelected(true);
        //this.optFD50Text.setColor(cc.color.GREEN);
        this.optFD30CheckBox.setSelected(false);
        //this.optFD30Text.setColor(cc.color.WHITE);
        this.optFD100CheckBox.setSelected(false);
        //this.optFD100Text.setColor(cc.color.WHITE);
        //this.optCostX2DescLabel.setString("提示：房卡消耗翻倍");

        this.opt8juLabel.setString("8局(房卡x2)");
        this.opt16juLabel.setString("16局(房卡x4)");

        this.opt["FD50"] = true;
        delete this.opt["FD10"];
        delete this.opt["FD30"];
        delete this.opt["FD100"];

        //this.renew_desc();
        //this.OnWinPayCheckBox(null,null);
    },

    OnFD100CheckBox: function (sender , CheckBoxType) {
        this.optFD100CheckBox.setSelected(true);
        //this.optFD100Text.setColor(cc.color.GREEN);
        this.optFD50CheckBox.setSelected(false);
        //this.optFD50Text.setColor(cc.color.WHITE);
        this.optFD30CheckBox.setSelected(false);
        //this.optFD30Text.setColor(cc.color.WHITE);
        //this.optCostX2DescLabel.setString("提示：房卡消耗翻倍");

        this.opt8juLabel.setString("8局(房卡x3)");
        this.opt16juLabel.setString("16局(房卡x6)");

        this.opt["FD100"] = true;
        delete this.opt["FD10"];
        delete this.opt["FD30"];
        delete this.opt["FD50"];

        //this.renew_desc();
        //this.OnWinPayCheckBox(null,null);
    },
};
dwc.FGNIUNIU_Page = {
    roomType:"NIUNIU",
    setTarget : function(target)
    {
        this.target = target;
    },
    init : function(mainNode)
    {
        this.opt = {};
        var that = this;
        var rootNode = $.getNodeByName(mainNode,"ID_NODE_OPT_NIUNIU");
        rootNode.setVisible(false);
        this.rootNode = rootNode;
        this.opt8juCheckBox=$.getNodeByName(rootNode,"ID_BUTTON_8JU");
        this.opt8juCheckBox.addEventListener(function (sender,type) {
            that.On8juCheckBox(sender,type);
        },this);
        this.opt8juLabel=$.getNodeByName(rootNode,"ID_LABEL_8JU_TEXT");

        this.opt16juCheckBox=$.getNodeByName(rootNode,"ID_BUTTON_16JU");
        this.opt16juCheckBox.addEventListener(function (sender,type) {
            that.On16juCheckBox(sender,type);
        },this);
        this.opt16juLabel=$.getNodeByName(rootNode,"ID_LABEL_16JU_TEXT");

        var cjfjBtn=$.getNodeByName(rootNode,"ID_BUTTON_CJFJ");
        cjfjBtn.addClickEventListener(function () {
            that.OnCreateRoomBtnClick();

        });
        this.On8juCheckBox();
    },
    setVisible : function(bVisible)
    {
        this.rootNode.setVisible(bVisible);
    },
    OnCreateRoomBtnClick : function()
    {
        var that=this;
        if(dwc.Myself.GetMyRoom())
        {
            that.OnFanHuiRoom();
            return;
        }
        var minNumGem=1;

        if(this.jushu=="8JU")
        {
            minNumGem=1;
        }else  if(this.jushu=="16JU")
        {
            minNumGem=2;
        }

        if(dwc.Myself.GetData().GetGem()>=10)
        {
            //that.ShowLoading(true);

            var keys = [];
            for(var key in this.opt)
            {
                keys.push(key);
            }
            dwc.DT_Data_Login.SendCreateRoom(that.roomType,keys.join(";"),"1");
            that.target.Close();
        }else {
            if(this.target)
                this.target.OnShowHint("房卡低于10张不能使用此功能,请联系代理");
        }
    },
    On8juCheckBox: function (sender , CheckBoxType) {
        this.opt8juCheckBox.setSelected(true);
        //this.opt8juLabel.setColor(cc.color.GREEN);
        this.opt16juCheckBox.setSelected(false);
        //this.opt16juLabel.setColor(cc.color.WHITE);
        this.jushu="8JU";
        this.opt["8JU"] = true;
        delete this.opt["16JU"];

    },
    On16juCheckBox: function (sender , CheckBoxType) {
        this.opt16juCheckBox.setSelected(true);
        //this.opt16juLabel.setColor(cc.color.GREEN);
        this.opt8juCheckBox.setSelected(false);
        //this.opt8juLabel.setColor(cc.color.WHITE);
        this.jushu="16JU";
        this.opt["16JU"] = true;
        delete this.opt["8JU"];
        cc.log(this.opt);

    }
};
dwc.FGSG_Page = {
    roomType:"SG",
    setTarget : function(target)
    {
        this.target = target;
    },
    init : function(mainNode)
    {
        this.opt = {};
        var that = this;
        var rootNode = $.getNodeByName(mainNode,"ID_NODE_OPT_SG");
        rootNode.setVisible(false);
        this.rootNode = rootNode;
        this.opt8juCheckBox=$.getNodeByName(rootNode,"ID_BUTTON_8JU");
        this.opt8juCheckBox.addEventListener(function (sender,type) {
            that.On8juCheckBox(sender,type);
        },this);
        this.opt8juLabel=$.getNodeByName(rootNode,"ID_LABEL_8JU_TEXT");

        this.opt16juCheckBox=$.getNodeByName(rootNode,"ID_BUTTON_16JU");
        this.opt16juCheckBox.addEventListener(function (sender,type) {
            that.On16juCheckBox(sender,type);
        },this);
        this.opt16juLabel=$.getNodeByName(rootNode,"ID_LABEL_16JU_TEXT");

        var cjfjBtn=$.getNodeByName(rootNode,"ID_BUTTON_CJFJ");
        cjfjBtn.addClickEventListener(function () {
            that.OnCreateRoomBtnClick();
        });
        this.On8juCheckBox();
    },
    setVisible : function(bVisible)
    {
        this.rootNode.setVisible(bVisible);
    },
    OnCreateRoomBtnClick : function()
    {
        var that=this;
        if(dwc.Myself.GetMyRoom())
        {
            that.OnFanHuiRoom();
            return;
        }
        var minNumGem=1;

        if(this.jushu=="8JU")
        {
            minNumGem=1;
        }else  if(this.jushu=="16JU")
        {
            minNumGem=2;
        }

        if(dwc.Myself.GetData().GetGem()>=10)
        {
            //that.ShowLoading(true);

            var keys = [];
            for(var key in this.opt)
            {
                keys.push(key);
            }
            dwc.DT_Data_Login.SendCreateRoom(that.roomType,keys.join(";"),"1");
            this.target.Close();
        }else {
            if(this.target)
                this.target.OnShowHint("房卡低于10张不能使用此功能,请联系代理");
        }
    },
    On8juCheckBox: function (sender , CheckBoxType) {
        this.opt8juCheckBox.setSelected(true);
        //this.opt8juLabel.setColor(cc.color.GREEN);
        this.opt16juCheckBox.setSelected(false);
        //this.opt16juLabel.setColor(cc.color.WHITE);
        this.jushu="8JU";
        this.opt["8JU"] = true;
        delete this.opt["16JU"];

    },
    On16juCheckBox: function (sender , CheckBoxType) {
        this.opt16juCheckBox.setSelected(true);
        //this.opt16juLabel.setColor(cc.color.GREEN);
        this.opt8juCheckBox.setSelected(false);
        //this.opt8juLabel.setColor(cc.color.WHITE);
        this.jushu="16JU";
        this.opt["16JU"] = true;
        delete this.opt["8JU"];
        cc.log(this.opt);

    },
};

dwc.DLCreateRoomDialog=dwc.CommonAlertView.extend({
    roomType:"JHMJ",
    jushu:"8JU",

    ctor: function (target) {
        this._super();
        this.target = target;
        this.curPage = 0;
        this.initUI(target);
    },
    initUI: function (_msg) {
        var that = this;
        var mainNode = ccs.load(dwc.g_arrGCRes.dt_dlCreateRoom_json).node;

        this.addChild(mainNode);
        this.mainNode = mainNode;

        //提示
        this.hintBack=$.getNodeByName(mainNode,"ID_SPRITE_HINT_MSG");
        //this.hintBack.setVisible(false);
        this.hintLabel=$.getNodeByName(mainNode,"ID_LABEL_HINTLABEL");
        //this.OnShowHint("xxxxxxxxxxxxxxxxxxxxxxx");
        this.opt = {};
        this.jushu="8JU";
        this.opt["8JU"] = true;
        delete this.opt["16JU"];

        var btn_JiHu=this.btn_JiPingHu=$.getNodeByName(mainNode,"ID_BUTTON_JIPINGHU");
        btn_JiHu.addClickEventListener(function () {
            that.OnJiPingHuBtnClick();
        });
        var btn_TuiDaoHu=this.btn_TuiDaoHu=$.getNodeByName(mainNode,"ID_BUTTON_TUIDAOHU");
        btn_TuiDaoHu.addClickEventListener(function () {
            that.OnTuiDaoHuBtnClick();
        });

        var btn_GBMJ=this.btn_GBMJ=$.getNodeByName(mainNode,"ID_BUTTON_GBMJ");
        btn_GBMJ.addClickEventListener(function () {
            that.OnGBMJBtnClick();
        });
        var btn_XLCH=this.btn_XLCH=$.getNodeByName(mainNode,"ID_BUTTON_XLCH");
        btn_XLCH.addClickEventListener(function () {
            that.OnXLCHBtnClick();
        });
        var btn_JHMJ=this.btn_JHMJ=$.getNodeByName(mainNode,"ID_BUTTON_JHMJ");
        btn_JHMJ.addClickEventListener(function () {
            that.OnJHMJBtnClick();
        });
        var btn_CSMJ=this.btn_CSMJ=$.getNodeByName(mainNode,"ID_BUTTON_CSMJ");
        btn_CSMJ.addClickEventListener(function () {
            that.OnCSMJBtnClick();
        });
        var btn_NBMJ=this.btn_NBMJ=$.getNodeByName(mainNode,"ID_BUTTON_NBMJ");
        btn_NBMJ.addClickEventListener(function () {
            that.OnNBMJBtnClick();
        });
        var btn_ZJH=this.btn_ZJH=$.getNodeByName(mainNode,"ID_BUTTON_ZJH");
        btn_ZJH.addClickEventListener(function () {
            that.OnZJHBtnClick();
        });
        var btn_NIUNIU=this.btn_NIUNIU=$.getNodeByName(mainNode,"ID_BUTTON_NIUNIU");
        btn_NIUNIU.addClickEventListener(function () {
            that.OnNIUNIUBtnClick();
        });
        var btn_SG=this.btn_SG=$.getNodeByName(mainNode,"ID_BUTTON_SG");
        btn_SG.addClickEventListener(function () {
            that.OnSGBtnClick();
        });
        var closeBtn=$.getNodeByName(mainNode,"ID_BUTTON_CLOSE");
        closeBtn.addClickEventListener(function () {
            that.Close();
        });


        this.initTuiDaoHuPage();
        this.initJiPingHuPage();
        this.initGuoBiaoPage();
        this.initXLCHPage();

        this.initJHMJPage();
        this.initCSMJPage();
        this.initZJHPage();
        this.initNIUNIUPage();
        this.initSGPage();
        this.initNBMJPage();

        //dwc.TuiDaoHu_Page.setVisible(true);
        //dwc.JIPINGHU_Page.setVisible(true);

        //this.OnDFWFBtnClick();

        //this.btn_JiPingHu.setVisible(false);
        //this.btn_TuiDaoHu.setVisible(false);

        //this.On8juCheckBox();
        //this.OnGuiPaiCheckBox();


        this.mainButtons = [this.btn_JHMJ,this.btn_CSMJ,this.btn_ZJH,this.btn_NIUNIU,this.btn_SG,this.btn_TuiDaoHu];
        this.mainPages = [dwc.FGJHMJ_Page,dwc.FGCSMJ_Page,dwc.FGZJH_Page,dwc.FGNIUNIU_Page,dwc.FGSG_Page,dwc.FGTuiDaoHu_Page];

        this.OnJHMJBtnClick();
    },

    initTuiDaoHuPage : function(){
        var that = this;

        dwc.FGTuiDaoHu_Page.init(this.mainNode);
        dwc.FGTuiDaoHu_Page.setTarget(this);
    },

    initJiPingHuPage : function(){
        var that = this;

        dwc.FGJIPINGHU_Page.init(this.mainNode);
        dwc.FGJIPINGHU_Page.setTarget(this);
    },
    initGuoBiaoPage : function(){
        var that = this;

        dwc.FGGBMJ_Page.init(this.mainNode);
        dwc.FGGBMJ_Page.setTarget(this);
    },
    initXLCHPage : function(){
        var that = this;

        dwc.FGXLCH_Page.init(this.mainNode);
        dwc.FGXLCH_Page.setTarget(this);
    },
    initJHMJPage : function(){
        var that = this;

        dwc.FGJHMJ_Page.init(this.mainNode);
        dwc.FGJHMJ_Page.setTarget(this);
    },
    initCSMJPage : function(){
        var that = this;

        dwc.FGCSMJ_Page.init(this.mainNode);
        dwc.FGCSMJ_Page.setTarget(this);
    },
    initNBMJPage : function(){
        var that = this;

        dwc.FGNBMJ_Page.init(this.mainNode);
        dwc.FGNBMJ_Page.setTarget(this);
    },
    initZJHPage : function(){
        var that = this;

        dwc.FGZJH_Page.init(this.mainNode);
        dwc.FGZJH_Page.setTarget(this);
    },
    initNIUNIUPage : function(){
        var that = this;

        dwc.FGNIUNIU_Page.init(this.mainNode);
        dwc.FGNIUNIU_Page.setTarget(this);
    },
    initSGPage : function(){
        var that = this;

        dwc.FGSG_Page.init(this.mainNode);
        dwc.FGSG_Page.setTarget(this);
    },
    OnShowHint: function (content) {
        var that=this;
        this.hintLabel.setString(content);
        this.hintBack.stopAllActions();
        this.hintLabel.stopAllActions();
        this.hintBack.setVisible(true);
        this.hintLabel.setPosition(600,23);
        this.hintBack.runAction(cc.sequence(cc.delayTime(1.6),cc.callFunc(function () {
            that.hintBack.setVisible(false);
            that.hintLabel.setPosition(600,23);
        },this)))
        this.hintLabel.runAction(cc.moveTo(0.2,cc.p(600,75)));
    },
    OnJiPingHuBtnClick: function () {
        for(var i=0;i<this.mainButtons.length;i++)
        {
            var button = this.mainButtons[i];
            var page = this.mainPages[i];
            if(button == this.btn_JiPingHu)
            {
                button.setBright(false);
                button.setEnabled(false);
            }else{
                button.setBright(true);
                button.setEnabled(true);
            }
            if(page == dwc.FGJIPINGHU_Page)
            {
                page.setVisible(true);
            }else{
                page.setVisible(false);
            }
        }
    },
    OnTuiDaoHuBtnClick: function () {

        for(var i=0;i<this.mainButtons.length;i++)
        {
            var button = this.mainButtons[i];
            var page = this.mainPages[i];
            if(button == this.btn_TuiDaoHu)
            {
                button.setBright(false);
                button.setEnabled(false);
            }else{
                button.setBright(true);
                button.setEnabled(true);
            }
            if(page == dwc.FGTuiDaoHu_Page)
            {
                page.setVisible(true);
            }else{
                page.setVisible(false);
            }
        }
    },

    OnGBMJBtnClick: function () {
        for(var i=0;i<this.mainButtons.length;i++)
        {
            var button = this.mainButtons[i];
            var page = this.mainPages[i];
            if(button == this.btn_GBMJ)
            {
                button.setBright(false);
                button.setEnabled(false);
            }else{
                button.setBright(true);
                button.setEnabled(true);
            }
            if(page == dwc.FGGBMJ_Page)
            {
                page.setVisible(true);
            }else{
                page.setVisible(false);
            }
        }
    },
    OnXLCHBtnClick: function () {
        for(var i=0;i<this.mainButtons.length;i++)
        {
            var button = this.mainButtons[i];
            var page = this.mainPages[i];
            if(button == this.btn_XLCH)
            {
                button.setBright(false);
                button.setEnabled(false);
            }else{
                button.setBright(true);
                button.setEnabled(true);
            }
            if(page == dwc.FGXLCH_Page)
            {
                page.setVisible(true);
            }else{
                page.setVisible(false);
            }
        }
    },

    OnJHMJBtnClick: function () {
        for(var i=0;i<this.mainButtons.length;i++)
        {
            var button = this.mainButtons[i];
            var page = this.mainPages[i];
            if(button == this.btn_JHMJ)
            {
                button.setBright(false);
                button.setEnabled(false);
            }else{
                button.setBright(true);
                button.setEnabled(true);
            }
            if(page == dwc.FGJHMJ_Page)
            {
                page.setVisible(true);
            }else{
                page.setVisible(false);
            }
        }
    },

    OnCSMJBtnClick: function () {
        for(var i=0;i<this.mainButtons.length;i++)
        {
            var button = this.mainButtons[i];
            var page = this.mainPages[i];
            if(button == this.btn_CSMJ)
            {
                button.setBright(false);
                button.setEnabled(false);
            }else{
                button.setBright(true);
                button.setEnabled(true);
            }
            if(page == dwc.FGCSMJ_Page)
            {
                page.setVisible(true);
            }else{
                page.setVisible(false);
            }
        }
    },    
    OnZJHBtnClick: function () {
        for(var i=0;i<this.mainButtons.length;i++)
        {
            var button = this.mainButtons[i];
            var page = this.mainPages[i];
            if(button == this.btn_ZJH)
            {
                button.setBright(false);
                button.setEnabled(false);
            }else{
                button.setBright(true);
                button.setEnabled(true);
            }
            if(page == dwc.FGZJH_Page)
            {
                page.setVisible(true);
            }else{
                page.setVisible(false);
            }
        }
    },
    OnNIUNIUBtnClick: function () {
        for(var i=0;i<this.mainButtons.length;i++)
        {
            var button = this.mainButtons[i];
            var page = this.mainPages[i];
            if(button == this.btn_NIUNIU)
            {
                button.setBright(false);
                button.setEnabled(false);
            }else{
                button.setBright(true);
                button.setEnabled(true);
            }
            if(page == dwc.FGNIUNIU_Page)
            {
                page.setVisible(true);
            }else{
                page.setVisible(false);
            }
        }
    },
    OnSGBtnClick: function () {
        for(var i=0;i<this.mainButtons.length;i++)
        {
            var button = this.mainButtons[i];
            var page = this.mainPages[i];
            if(button == this.btn_SG)
            {
                button.setBright(false);
                button.setEnabled(false);
            }else{
                button.setBright(true);
                button.setEnabled(true);
            }
            if(page == dwc.FGSG_Page)
            {
                page.setVisible(true);
            }else{
                page.setVisible(false);
            }
        }
    },
    OnNBMJBtnClick: function () {
        for(var i=0;i<this.mainButtons.length;i++)
        {
            var button = this.mainButtons[i];
            var page = this.mainPages[i];
            if(button == this.btn_NBMJ)
            {
                button.setBright(false);
                button.setEnabled(false);
            }else{
                button.setBright(true);
                button.setEnabled(true);
            }
            if(page == dwc.FGNBMJ_Page)
            {
                page.setVisible(true);
            }else{
                page.setVisible(false);
            }
        }
    },

});


